process {
    withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMI(COLLAPSE|TOOLS)_GENOME:UMI(COLLAPSE|TOOLS_DEDUP)' {
        ext.prefix = { "${meta.id}_umi_dedup.genome" }
    }

    withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMI(COLLAPSE|TOOLS)_TRANSCRIPTOME:UMI(COLLAPSE|TOOLS_DEDUP)' {
        ext.prefix = { "${meta.id}.umi_dedup.transcriptome.sorted" }
    }

    withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMI(COLLAPSE|TOOLS)_GENOME:UMI(COLLAPSE|TOOLS_DEDUP)' {
        ext.prefix = { "${meta.id}.umi_dedup.genome.sorted" }
    }

    withName: 'UMITOOLS_PREPAREFORRSEM' {
        ext.prefix = { "${meta.id}_preparedforrsem" }
    }

    withName: 'BAM_DEDUP_UMI:SAMTOOLS_SORT' {
        ext.args   = '-n'
        ext.prefix = { "${meta.id}.umi_dedup.transcriptome" }
    }

    withName: 'BAM_DEDUP_UMI:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_SORT' {
        ext.prefix = { "${meta.id}.transcriptome.sorted" }
    }

    withName: 'BAM_DEDUP_UMI:BAM_SORT_STATS_SAMTOOLS:BAM_STATS_SAMTOOLS:.*' {
        ext.prefix = { "${meta.id}.transcriptome.sorted.bam" }
    }

    withName: 'BAM_DEDUP_UMI:BAM_DEDUP_STATS_SAMTOOLS_UMI(COLLAPSE|TOOLS)_TRANSCRIPTOME:BAM_STATS_SAMTOOLS:.*' {
        ext.prefix = { "${meta.id}.umi_dedup.transcriptome.sorted.bam" }
    }

    withName: 'BAM_DEDUP_UMI:BAM_DEDUP_STATS_SAMTOOLS_UMI(COLLAPSE|TOOLS)_GENOME:BAM_STATS_SAMTOOLS:.*' {
        ext.prefix = { "${meta.id}.umi_dedup.genome.sorted.bam" }
    }
}
